package com.suisui.murmur;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author yanchengji 2018/2/23 17:13
 * @version 1.0.0
 */
@Controller
public class DemoController {
    private static final Logger log = LoggerFactory.getLogger(DemoController.class);

    @RequestMapping(value = "/jsp", method = RequestMethod.GET)
    public String jsp(Model model) {
        log.info("hello world");
        return "success";
    }


    @RequestMapping(value="/vm")
    public ModelAndView vm(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView mav= new ModelAndView();
        mav.addObject("city","test");
        mav.setViewName("hello");
        return mav;
    }

    @RequestMapping(value="/ftl")
    public ModelAndView ftl(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView mav= new ModelAndView();
        mav.addObject("name","lansuisui");
        mav.addObject("age","4");
        mav.setViewName("hello");
        return mav;
    }
}
